package com.bvblogic.android;

import org.json.JSONObject;


public class Promo {
	
	public static final String PROMO_KEY_PROMO_ID 		= "promo_id";
	public static final String PROMO_KEY_PLACE_ID 		= "place_id";
	public static final String PROMO_KEY_PHOTO	 		= "img";
	public static final String PROMO_KEY_TITLE 			= "title";
	public static final String PROMO_KEY_DESCR	 		= "short_desc";

	private String promoId;
	private String placeId;
	private String avatarkaUrl;
	private String title;
	private String description;
	
//	public Promo(int promoId, int imageRes, String title, String description) {
//		this.promoId = promoId;
//		this.imageRes = imageRes;
//		this.title = title;
//		this.description = description;
//	}
	public static Promo initPromoFromJSON (JSONObject jsonObject){
		if (jsonObject == null || jsonObject.length() == 0)
			return null;
		Promo promo = new Promo();
		
		String value;
		
		value = jsonObject.optString(PROMO_KEY_PROMO_ID);
		if (value != null && !(value.equals(null)))
			promo.promoId = value;
		
		value = jsonObject.optString(PROMO_KEY_PLACE_ID);
		if (value != null && !(value.equals(null)))
			promo.placeId = value;
		
		value = jsonObject.optString(PROMO_KEY_DESCR);
		if (value != null && !(value.equals(null)))
			promo.description = value;
		
		value = jsonObject.optString(PROMO_KEY_TITLE);
		if (value != null && !(value.equals(null)))
			promo.title = value;
		
		value = jsonObject.optString(PROMO_KEY_PHOTO);
		if (value != null && !(value.equals(null)))
			promo.avatarkaUrl = value;
		
		value = null;
		return promo;
	}
	
	public String getPromoId() {
		return promoId;
	}
	public void setPromoId(String promoId) {
		this.promoId = promoId;
	}
	public String getImageRes() {
		return avatarkaUrl;
	}
	public void setImageRes(String imageRes) {
		this.avatarkaUrl = imageRes;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getPlaceId() {
		return placeId;
	}
	public void setPlaceId(String placeId) {
		this.placeId = placeId;
	}
	
	
}
